//
//  SEPatientFileBasicViewModel.swift
//  SmartEyeForPatient
//
//  Created by qdsg on 2021/4/17.
//

import Foundation

class SEPatientFileBasicViewModel: SEBaseViewModel {

    var patientViewModel = SEPatientDetailViewModel()

    var dataSource: [[SEPatientTitleTextFieldCellModel]] {
        return [
            [
                SEPatientTitleTextFieldCellModel(title: "身高", placeHolder: "未填写", cellType: .unit, unit: "cm", text: patientViewModel.model.height),
                SEPatientTitleTextFieldCellModel(title: "体重", placeHolder: "未填写", cellType: .unit, unit: "kg", text: patientViewModel.model.weight),
                SEPatientTitleTextFieldCellModel(title: "是否吸烟", placeHolder: "", cellType: .segment, unit: "", segmentArray: ["经常", "偶尔", "否"], segmentSelectedIndex: patientViewModel.smokingType.selectedIndex),
                SEPatientTitleTextFieldCellModel(title: "是否饮酒", placeHolder: "", cellType: .segment, unit: "", segmentArray: ["大量", "少量", "否"], segmentSelectedIndex: patientViewModel.dringkingType.selectedIndex),
                SEPatientTitleTextFieldCellModel(title: "是否有过敏史", placeHolder: "", cellType: .segment, unit: "", segmentArray: ["是", "否"], segmentSelectedIndex: patientViewModel.allergyType.selectedIndex),
            ],
            [
                SEPatientTitleTextFieldCellModel(title: "既往史")
            ]
        ]
    }

    // MARK: - APIRequest

    func requestPatientDetail() {
        patientViewModel.requestPatientDetail()
        patientViewModel.updateData = { status in
            self.updateData?(status)
        }
    }
}
